﻿namespace Renci.iRods.Studio.Models
{
    using System.Configuration;
    using Renci.iRods.Studio.Models;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Xml.Serialization;

    [SettingsGroupName("profile")]
    public class Profile : ApplicationSettingsBase
    {
        public Profile()
        {
            //  Build connection profiles
            if (this["connectionProfiles"] == null)
                this["connectionProfiles"] = new ObservableCollection<ConnectionProfile>();
        }
        
        [UserScopedSetting()]
        [SettingsSerializeAs(SettingsSerializeAs.Binary)]
        public ObservableCollection<ConnectionProfile> ConnectionProfiles
        {
            get
            {
                return ((ObservableCollection<ConnectionProfile>)this["connectionProfiles"]);
            }
            set
            {
                this["connectionProfiles"] = value;
            }
        }

        public override void Save()
        {
            base.Save();

            this.OnPropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs("ConnectionProfiles"));
        }
    }
}
